<include file="Public:head" />
<script src="__PUBLIC__/js/jquery/lazyload.js" type="text/javascript"></script>
<script type="text/javascript" language="javascript" src="__PUBLIC__/js/jquery/jquery.carouFredSel-6.2.1-packed.js"></script>
<script type="text/javascript" language="javascript">
    $(function() {
        $("#promotion_carousel").carouFredSel({items: 1, width: 700, height: "{$ads_index_banner_height}", direction: "up", infinite: true, circular: false, items:1, auto: {timeoutDuration: 5000, duration: 300, pauseOnHover: true}, pagination: {container: ".carousel_pager", anchorBuilder: function(f) {
                    return'<li class="pgn">' + f + "</li>"
                }}})
    });
</script>
<div id="wrap">
    <div id="school_index">{$type=0|getAreaName} <a href="__APP__/?type=clean">[切换位置]</a></div>
    <div id="container" class="clearfix">
        <div id="left">
            <div id="promotion_banner" class="promotion-banner" <if condition="$ads_index_banner_height gt 0"> style="height:{$ads_index_banner_height}px;" </if>>
                <div class="caroufredsel_wrapper" style="display: block; text-align: start; float: none; position: relative; top: auto; right: auto; bottom: auto; left: auto; z-index: auto; width: 100%; height: {$ads_index_banner_height}px; margin: 0px; overflow: hidden;">
                    <ul id="promotion_carousel" class="carousel-wrapper" style="text-align: left; float: none; position: absolute; top: 0px; right: auto; bottom: auto; left: 0px; margin: 0px; width: 100%; z-index: auto;">
                        <foreach name="adsIndexBanner" item="row">
                            <li class="carousel-block" style="margin-bottom: 0px;">
                                <a data-id="promotion_banner_nj-sxhb"  target="_blank" rel="nofollow">
                                    <img src="__APP__/{$Think.config.picFile}{$row.logo}" width="100%" >
                                </a>
                            </li>
                        </foreach>
                    </ul>
                </div>
                <ol class="carousel_pager carousel-pager" style="display: block;">
                    <foreach name="adsIndexBanner" item="row">
                        <li class="pgn <if condition='$key eq 0'>class='selected'</if>">1</li>
                    </foreach>
                </ol>
            </div>
            <div id="onlineSup" class="sup_list">
                <div class="sup_list_title">
                    <h2>在线订餐</h2>
                    <p class="si_filter">
                        <input  class="fl" type="checkbox" autocomplete="off" onclick="showCheckbox2($(this), '.si_closed')"/><span class="fl">仅显示营业中</span>
                    </p>
                    <p class="step">
                        <span>选餐厅</span><span>选美食</span><span>下订单</span><span>餐到付款</span></p>
                </div>
                <div class="sup_list_body shadow" id="hallListOnline">
                    <ul>
                        <foreach name="lists" key="key" item="row">
                            <li>
                                <div class="si_block {$row.shopCla}" data-addr="{$row.addr}"data-sendtime="{$row.sendtime}"data-startprice="{$row.startprice}"
                                     data-announce="{$row.announce}" data-dish_type="{$row.dish_type|getStaticInfo=###=###,'dictionary','name'}" data-business_time="{$row.business_time|getbusiness_time=###}"
                                     onclick="goUrl($(this).children('.si_logo').children('a').attr('href'))">
                                    <div class="si_logo">
                                        <a href="{:U('Area/detail',array('id'=>$row['id']))}" target="_blank">
                                            <img src="__PUBLIC__/images/grey.gif" class="lazy" original="{$row.logo|getShopLogo=###,43}"
                                                 alt="{$row.name}" width="43px" height="43px" /></a>
                                    </div>
                                    <div class="si_info">
                                        <p class="si_name">
                                            <a href="{:U('Area/detail',array('id'=>$row['id']))}"  target="_blank" class="name">{$row.name|msubstr=0,7,'utf-8',false}</a></p>
                                       
                                        <p class="starArea">{$row.star|getStar=###}</p>
                                        
                                        <p class="rest">{$row.business_time|getShopState=###,$row['weeks'],$row['is_busy']}</p>

                                    </div>
                                     
                                    <div class="clear"></div>
                                    <if condition="$row.shopCla eq ''">
                                     <p class="start"style="margin:5px 0 0;color:#aaa">
                                          <if condition='$row.sendprice eq 0'>免费配送<else/>配送: ¥{$row.sendprice}</if>
                                         <span style='margin-left: 10px'>{$row.sendtimes|getMinSendTime=###,1}</span>
                                     </p>
                                     </if>
                                    <if condition="$row.shopCla eq ''">
                                        <div class='si_ac' style="margin:5px 0 0" >{$row.sales|getShopAttr=###}</div>
                                    </if>
                                </div>
                            </li>
                        </foreach>
                        <div class="clear"></div>
                    </ul>
                </div>
                <!--end of sup_list_body-->
            </div>
            <!--在线餐厅结束-->
            <div class="nofind">
                没找到熟悉的餐厅？您可以<span  onclick="recommendShops()">推荐新餐厅</span><em>(您推荐的餐厅必须有外卖服务哦～)</em>
            </div>
        </div>
        <!--end of left-->
        <include file="Public:areaRight" />
    </div>
    <!--end of container-->
    <include file="Public:foot" />

    <div class="shopTip">
        <div class="sup_detail br3 clearfix">
            <div class="detail_info">
                <div class="row1">
                    <img width="43px" height="43px" id="logoBox"/>
                    <p class="t_name" id="name"></p>
                    <p class="t_type" id="dish_type"></p>
                </div>
                <p>
                    <span class="t_com"></span>
                    <span class="t_rec"></span>
                </p>
                <p class="t_status" id="t_status" style="background:lightgreen"></p>
                <p class="t_time">
                    <b>送餐时间：</b>
                    <span id="business_time"></span>
                </p>
                <p class="t_intro">
                    <b>公告：</b>
                    <span id="announce"></span>
                </p>
                <p class="t_send"><b>起送价：</b><span id="startprice"></span></p>
                <p class="t_addr"><b>地址：</b><span id="addr"></span></p>
            </div>
        </div>
        <span class="arrow"></span>
    </div>
    <script type="text/javascript">
        $(function() {
            $("img.lazy").lazyload({
                effect: "fadeIn"
            });
            $('.si_block').hover(function() {
                var cla = 'shine_red';
                if ($(this).parent().parent().parent().attr("id") == 'hallListOffline') {
                    cla = 'shine_blue';
                    $(".sup_detail").css({"border": "2px solid #69acdc"});
                } else {
                    $(".sup_detail").css({"border": "2px solid #FA8668"});
                }
                $(this).addClass(cla);


                var width = $(this).outerWidth();
                var left = $(this).offset().left + width;
                var top = $(this).offset().top - 20;
                $(".shopTip").css({"left": left, "top": top}).show();
                $('#dish_type').text($(this).attr("data-dish_type"));
                $('#addr').text($(this).attr("data-addr"));
                $('#startprice').text($(this).attr("data-startprice") + "元起送");
                $('#business_time').text($(this).attr("data-business_time"));
                var announce = $(this).attr("data-announce");
                $('#announce').text(announce);

                if (announce) {
                    $('#announce').text(announce);
                    $('#announce').parent().show();
                } else {
                    $('#announce').text('');
                    $('#announce').parent().hide();
                }
                var logo = $(this).find("img.lazy").attr("src");
                $('#logoBox').attr("src", logo);
                $('#name').text($(this).find("a.name").text());
                var t_status = '';
                var rest = $(this).find('.rest').text();
                $('#t_status').show();
                if (rest == '') {
                    $('#t_status').hide();
                } else if (rest == '已打烊') {
                    t_status = '已打烊，不用担心，已经成功的订单均有效';
                } else if (rest == '休息已放假') {
                    t_status = "餐厅已休假，暂不提供外卖服务";
                } else {
                    t_status = "餐厅已休息，" + rest + "";
                }
                $('#t_status').text(t_status);
            }, function() {
                var cla = 'shine_red';
                if ($(this).parent().parent().parent().attr("id") == 'hallListOffline') {
                    cla = 'shine_blue';
                }
                $(this).removeClass(cla);
                $(".shopTip").hide().css({"left": 0, "top": 0});
            })
        })

    </script>